<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div></div>
    <p>
      123
      <span>123</span>
    </p>
    <script>
      // innerText和innerHTML的区别
      //innerText不识别HTML标签 非标准 去空格和换行
      var div = document.querySelector("div");
      div.innerText = "<strong>今天是:</strong>2019";
      //innerHTML 识别HTML标签 W3C标准 保留空格换行
      div.innerHTML = "<strong>今天是:</strong>2019";
      //这两个属性可以读写 可以获取元素里边的内容
      var p = document.querySelector("p");
      console.log(p.innerText);
      console.log(p.innerHTML);
      p.innerText = "123456";
    </script>
  </body>
</html>
